<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<div>
    <logic:present name="acc">
        <logic:equal name="roleUser" value="car">
            <p align="right">
                <a href="AdminCar.do?action=listCarOrder" >Order manager</a>&emsp;&emsp;&emsp;
                <a href="AdminCar.do?action=listCar" >Car manager</a>&emsp;&emsp;&emsp;
                <a href="AdminCar.do?action=listCarModel" >Model manager</a> &emsp;&emsp;&emsp;
                <a href="AdminCar.do?action=listCarType">Type manager</a>
            </p>
        </logic:equal>
        <logic:present name="listCar">
            <logic:notEmpty name="listCar">
                <pg:pager url="paging.do" maxIndexPages="10" maxPageItems="10">
                    <pg:param name="action" value="pagingCar"/>
                    <table width="100%" border="0">
                        <tr bgcolor="#C2D1D8">
                            <td><font size="3"> Car Id </font></td>
                            <td><font size="3"> Car Name  </font></td>
                            <td><font size="3"> Mode </font></td>
                            <td><font size="3"> Type </font></td>
                            <td><font size="3"> Airconditional </font></td>
                            <td><font size="3"> Quantity </font></td>
                            <td><font size="3"> Seatquantity </font></td>
                            <td><font size="3"> Price </font></td>
                            <td><font size="3"> Images </font></td>
                            <td><font size="3"> Action </font> </td>
                        </tr>
                        <logic:iterate name="listCar" id="listCar">
                            <pg:item>
                                <tr bgcolor="#F0F0F0">
                                    <td style="background-color:#F0F0F0">
                                        <font size="2">  <bean:write name="listCar" property="detailDTO.carId"/> </font>
                                    </td>
                                    <td style="background-color:#F0F0F0">
                                        <font size="2"> <bean:write name="listCar" property="carName"/> </font>
                                    </td>

                                    <td style="background-color:#F0F0F0">
                                        <font size="2"> <bean:write name="listCar" property="modelDTO.modelName"/> </font>
                                    </td>
                                    <td style="background-color:#F0F0F0">
                                        <font size="2"> <bean:write name="listCar" property="typeDTO.typeName"/> </font>
                                    </td>
                                    <td style="background-color:#F0F0F0">
                                        <logic:equal name="listCar" property="airConditional" value="1">
                                            Yes
                                        </logic:equal>
                                        <logic:equal name="listCar" property="airConditional" value="0">
                                            No
                                        </logic:equal>
                                    </td>
                                    <td style="background-color:#F0F0F0">
                                        <font size="2"> <bean:write name="listCar" property="quantity"/> </font>
                                    </td>
                                    <td style="background-color:#F0F0F0">
                                        <font size="2"> <bean:write name="listCar" property="seatQty"/> </font>
                                    </td>
                                    <td style="background-color:#F0F0F0">
                                        <font size="2"> <bean:write name="listCar" property="price"/> </font>
                                    </td>
                                    <td style="background-color:#F0F0F0">
                                        <font size="2"> <bean:write name="listCar" property="detailDTO.imageUrl"/> </font>
                                    </td>
                                    <td style="background-color:#F0F0F0">
                                        <logic:present name="listFunction">
                                            <logic:iterate name="listFunction" id="listF">
                                                <logic:equal name="listF" property="functionId" value="4">
                                                    <a href="AdminCar.do?action=addnewCar">
                                                        <img title="Add" src="admin/img/action_add.png"  style="cursor:pointer">
                                                    </a>
                                                </logic:equal>
                                                <logic:equal name="listF" property="functionId" value="5">
                                                    <a href="AdminCar.do?action=editCar&carId=<bean:write name="listCar" property="detailDTO.carId"/>">
                                                        <img title="Edit" src="admin/img/action_remove.png" style="cursor:pointer">
                                                    </a>
                                                </logic:equal>
                                                <logic:equal name="listF" property="functionId" value="6">
                                                    <a href="AdminCar.do?action=deleteCar&carId=<bean:write name="listCar" property="detailDTO.carId"/>">
                                                        <img title="Delete" src="admin/img/action_delete.png" name="action" style="cursor:pointer" />
                                                    </a>
                                                </logic:equal>
                                            </logic:iterate>
                                        </logic:present>



                                    </td>
                                </tr>
                            </pg:item>
                        </logic:iterate>
                        <tr bgcolor="#C2D1D8">
                            <td colspan="10"><font color="#C2D1D8">car id </font></td>

                        </tr>
                        <tr>
                            <td colspan="10" align="center">

                                <pg:index>
                                    <pg:prev><a href="<%= pageUrl%>"><font color="#0D6AC1">[&lt;&lt;Prev]</font></a></pg:prev>
                                    <pg:pages><a href="<%= pageUrl%>"><%= pageNumber%>&nbsp;&nbsp;</a></pg:pages>
                                    <pg:next ><a href="<%= pageUrl%>"><font color="#0D6AC1">[Next&gt;&gt;]</font></a></pg:next>
                                </pg:index>
                            </td>

                        </tr>
                    </table>
                </pg:pager>
            </logic:notEmpty>
            <logic:empty name="listCar">
                ban chi dc xem thong tin ma thoi
            </logic:empty>
        </logic:present>
        <logic:notPresent name="listCar">
            ban chi dc xem thong tin ma thoi
        </logic:notPresent>
    </logic:present>
    <logic:notPresent name="acc">
        <jsp:forward page="adminHome.jsp"/>
    </logic:notPresent>
</div>
